package main.java.person.fjsp.algorithm.ts.entity;


import java.util.ArrayList;
import java.util.List;

/**
 * 析取图中的一个节点
 * @author xcy
 */
public class DisjunctiveGraphNode {
    /**
     * 该节点对应的工序编号
     */
    private final String operationCode;
    /**
     * 该节点对应的工序所属的作业号
     */
    private int jobNum;
    /**
     * 该节点对应的工序所属的机器
     */
    private int machineNum;
    /**
     * 节点的权重，即节点的处理时间
     */
    private int processTime;
    /**
     * 节点的编号
     */
    private int number;
    /**
     * 节点的头长度
     */
    private int startTime;
    /**
     * 节点的尾长度
     */
    private int tailTime;
    /**
     * 该节点的所有前驱节点集合
     */
    private final List<Integer> preNodes;
    /**
     * 该节点的所有后序节点集合
     */
    private final List<Integer> nextNodes;
    /**
     * 该节点的最晚的前驱节点
     */
    private Integer latestPreNode;

    public DisjunctiveGraphNode(String operationCode, int number, List<Integer> preNodes, List<Integer> nextNodes) {
        this.operationCode = operationCode;
        this.number = number;
        this.preNodes = preNodes;
        this.nextNodes = nextNodes;
    }

    public DisjunctiveGraphNode(String operationCode, int jobNum, int machineNum, int processTime, int number, int startTime, int tailTime, List<Integer> preNodes, List<Integer> nextNodes, Integer latestPreNode) {
        this.operationCode = operationCode;
        this.jobNum = jobNum;
        this.machineNum = machineNum;
        this.processTime = processTime;
        this.number = number;
        this.startTime = startTime;
        this.tailTime = tailTime;
        this.preNodes = preNodes;
        this.nextNodes = nextNodes;
        this.latestPreNode = latestPreNode;
    }



    public DisjunctiveGraphNode clone(){
        return new DisjunctiveGraphNode(operationCode,jobNum,machineNum,processTime,number,startTime,tailTime,new ArrayList<>(preNodes),new ArrayList<>(nextNodes),latestPreNode);
    }

    public int getStartTime() {
        return startTime;
    }

    public void setStartTime(int startTime) {
        this.startTime = startTime;
    }

    public int getTailTime() {
        return tailTime;
    }

    public void setTailTime(int tailTime) {
        this.tailTime = tailTime;
    }

    public String getOperationCode() {
        return operationCode;
    }

    public int getNumber() {
        return number;
    }

    public List<Integer> getPreNodes() {
        return preNodes;
    }

    public List<Integer> getNextNodes() {
        return nextNodes;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public int getMachineNum() {
        return machineNum;
    }

    public void setMachineNum(int machineNum) {
        this.machineNum = machineNum;
    }

    public int getJobNum() {
        return jobNum;
    }

    public void setJobNum(int jobNum) {
        this.jobNum = jobNum;
    }

    public int getProcessTime() {
        return processTime;
    }

    public void setProcessTime(int processTime) {
        this.processTime = processTime;
    }

    public Integer getLatestPreNode() {
        return latestPreNode;
    }

    public void setLatestPreNode(Integer latestPreNode) {
        this.latestPreNode = latestPreNode;
    }

    @Override
    public String toString() {
        return number+"{" +
                operationCode +
                ", jobNum=" + jobNum +
                ", machineNum=" + machineNum +
                ", processTime=" + processTime +
                ", startTime=" + startTime +
                ", tailTime=" + tailTime +
                ", preNodes=" + preNodes +
                ", nextNodes=" + nextNodes +
                ", latestPreNode=" + latestPreNode +
                '}';
    }
}
